package org.poem.listener;

import org.poem.event.DemoEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * Created by poem on 2017/8/27.
 */
@Component
public class DemoListener implements ApplicationListener<DemoEvent> {

    /**
     * 使用onApplicationEvent方法对消息进行接受
     * @param event
     */
    @Override
    public void onApplicationEvent(DemoEvent event) {
        String msg = event.getMsg();
        System.err.println("我(Bean-demoListener)接受到Bean-DemoPulisher发布的消息："+ msg);
    }
}
